package com.ea.report.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ea.common.mybatis.EmoAnalyBaseMapper;
import com.ea.common.report.pojo.vo.*;

import com.ea.report.pojo.dto.DashboardDepartmentWarningDto;
import com.ea.report.pojo.dto.ReportDetailInfoDto;
import com.ea.report.pojo.dto.UserDetailCountDto;
import com.ea.report.pojo.dto.WarningPersonDto;
import com.ea.report.pojo.po.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface ReportInfoMapper extends EmoAnalyBaseMapper<ReportInfo> {
    UserDetailCountDto getUserDetailCountDtoByUserId(
            @Param("userId") Long userId
    );

    List<ReportInfo> getUnfinishedReport();

    ReportInfo selectReportInfoByUuid(
            @Param("uuid") String uuid
    );

    Page<ReportSimpleInfoVo> getReportList(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("userIdList") List<Long> userIdList,
            @Param("warningTypeList") List<Integer> warningTypeList,
            @Param("statusList") List<Integer> statusList,
            @Param("name") String name,
            @Param("postStartDate") Date postStartDate,
            @Param("postEndDate") Date postEndDate,
            @Param("receiveStartDate") Date receiveStartDate,
            @Param("receiveEndDate") Date receiveEndDate,
            @Param("emoAnalyStartDate") Date emoAnalyStartDate,
            @Param("emoAnalyEndDate") Date emoAnalyEndDate,
            @Param("heartRateStartDate") Date heartRateStartDate,
            @Param("heartRateEndDate") Date heartRateEndDate,
            Page<ReportSimpleInfoVo> reportSimpleInfoVoPage);

    ReportDetailInfoDto selectReportDetailInfoVo(
            @Param("reportId") Long reportId
    );

    List<NormVo> getPersonalNorm(
            @Param("userId") Long userId,
            @Param("startDate") Date startDate,
            @Param("endDate") Date endDate
    );

    List<NormVo> getGroupNorm(
            @Param("companyId") Long companyId
    );

    /**
     * 查询预警人数
     */
    Page<StatsWarningType> selectStatsWarningType(
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<StatsWarningType> page
    );

    Page<StatsWarningProperties> selectStatsWarningProperties(
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<StatsWarningProperties> page
    );

    Page<StatsGroupEmotionalMap> selectStatsGroupEmotionalMap(
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<StatsGroupEmotionalMap> page
    );

    Page<StatsGroupPersonalityMap> selectStatsGroupPersonalityMap(
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<StatsGroupPersonalityMap> page
    );


    GetWarningInfoVo getWarningInfoDto(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("name") String name
    );

    GetWarningInfoVo getWarningInfoDtoWithDate(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("name") String name,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate
    );

    Page<WarningPersonDto> getWarningPersonDto(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("name") String name,
            @Param("warningTypeList") List<Integer> warningTypeList,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<WarningPersonDto> page
    );

    Page<WarningPersonDto> getWarningPersonDtoByPropertiesId(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("propertiesIdList") List<Long> propertiesIdList,
            @Param("name") String name,
            @Param("warningTypeList") List<Integer> warningTypeList,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<WarningPersonDto> page
    );

    Integer getWarningCountByDate(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate
    );

    List<PersonEmotionTypeVo> getPersonEmotionTypeVoList(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList);


    DashboardVo getDashboardStats(@Param("companyIdList") List<Long> companyIdList,
                                  @Param("deptIdList") List<Long> deptIdList,
                                  @Param("startDate") String startDate,
                                  @Param("endDate") String endDate);

    List<DashboardDepartmentWarningDto> getDashboardDepartmentWarningVo(@Param("companyIdList") List<Long> companyIdList,
                                                                        @Param("deptIdList") List<Long> deptIdList,
                                                                        @Param("startDate") String startDate,
                                                                        @Param("endDate") String endDate);

    List<PersonEmotionTypeVo> getPersonEmotionTypeVoList(@Param("companyIdList") List<Long> companyIdList,
                                                         @Param("deptIdList") List<Long> deptIdList,
                                                         @Param("startDate") String startDate,
                                                         @Param("endDate") String endDate);


    StatsGroupEmotionalMapVo getStatsGroupEmotionalMapVo(@Param("companyIdList") List<Long> companyIdList,
                                                         @Param("deptIdList") List<Long> deptIdList,
                                                         @Param("startDate") String startDate,
                                                         @Param("endDate") String endDate);


    Page<WarningPersonDto> getWarningPersonDtoOfDash(
            @Param("companyIdList") List<Long> companyIdList,
            @Param("deptIdList") List<Long> deptIdList,
            @Param("positionIdList") List<Long> positionIdList,
            @Param("name") String name,
            @Param("warningTypeList") List<Integer> warningTypeList,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            Page<WarningPersonDto> page
    );

    ReportDetailInfoDto selectReportDetailInfoVoByMd5(
            @Param("userId") Long userId,
            @Param("uuid") String uuid
    );

    ReportInfo selectByMd5(
            @Param("userId") Long userId,
            @Param("uuid") String uuid
    );

}
